LearningDataModel.CreateObjective Method

Creates a Objective object, which may then be used to be added to the Objectives list.

Parent Type: LearningDataModel

Namespace: Microsoft.LearningComponents.DataModel

Assembly: Microsoft.LearningComponents.dll

Syntax
C#

public Objective CreateObjective ()

Return Value

A new Objective object associated with this LearningDataModel.

Exceptions
Exception type Condition
InvalidOperationException

Thrown if this LearningDataModel object cannot be written to.

Example

The following example demonstrates creating a new objective and adding it to the Objectives collection.

C#
LearningSession session = ... ; // get LearningSession object

Objective o = session.CurrentActivityDataModel.CreateObjective();
o.Id = "objective1"; // A unique identifier is required before this is added to the list
o.Description = "a description of objective 1";
session.CurrentActivityDataModel.Objectives.Add(o);